<%@page import="Entity.Machine"%>
<%@page import="Entity.Maintenance"%>
<%@page import="Entity.Room"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'pop_comp.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
	<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
	<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<link rel="shortcut icon" type="image/x-icon" href="logo.jpg" />
  </head>
  
  <body>
  	<%
  	List<Machine> list_machine =(List<Machine>) request.getAttribute("lm");
  	String room_id=(String)request.getAttribute("room");
  	 %>
    <form action="" method="post">
    <a type="button" class="btn btn-primary  btn-sm" data-toggle="modal" data-target="#myModal"
    style="background-color:#195D75;margin: 18px 0 0 26px;">添加</a>
    	<table class="table table table-hover" style=";text-align: center;margin: 10px auto;">
	    	<thead>
	    		<tr style="background-color: #2B727E; color: white;">
	    		<td>机房</td><td>座位号</td><td>维修信息</td><td>操作</td>
	    		</tr>
	    	</thead>
	    	<tbody>
	    	<%
	    		if(list_machine!=null){
	    			
	    			for(Machine machine:list_machine){
	    				if(machine.isIf_Damage()){ 
	    			%>
	    				<tr>
	    				<td><%=room_id %></td>
	    				<td><%=machine.getMachine_Id() %></td>
	    				<td>机器损坏</td>
	    				<td><a href="NoDanmsgeServlet?room=<%=room_id%>&machine=<%=machine.getMachine_Id()%>">删除</a></td>
	    				</tr>
	    				<% 
	    				}
	    			}
	    		}
	    	 %>
		   
		   </tbody>
		</table>
    </form>
    <!-- 模态框（Modal） -->
		<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		    <div class="modal-dialog">
		        <div class="modal-content">
		            <div class="modal-header">
		                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
		                <h4 class="modal-title" id="myModalLabel">添加损坏机器</h4>
		            </div>
		            <div class="modal-body">
						<form action="DamageminServlet?room=<%=room_id %>" method="post" class="form-horizontal" role="form">
					  		<div class="form-group">
							    <label for="firstname" class="col-sm-2 control-label">座位号</label>
							    <div class="col-sm-10">
							      <input type="text" class="form-control" name="machine" id="firstname" placeholder="请输入出故障的电脑所在位置">
							    </div>
							</div>
					    	<div class="form-group">
							    <div class="col-sm-offset-2 col-sm-10">
							      <button type="submit" class="btn btn-default">确定</button>
							    </div>
							</div>
					  	</form>
					</div>
		        </div><!-- /.modal-content -->
		    </div><!-- /.modal -->
		</div>
  </body>
</html>
